﻿using System;
using System.IO;
using System.Windows;
using System.Windows.Markup;
namespace QDP.Platform.Loader
{
    public class XamlThemeParser : IParser
    {
        public void Parse(string file,System.IO.Stream stream)
        {
            try
            {
                D.Debug("XAML 样式资源");
                StreamReader r = new StreamReader(stream);
                object xamlObj = XamlReader.Load(r.ReadToEnd());
                if (xamlObj is ResourceDictionary)
                {
                    Application.Current.Resources.MergedDictionaries.Add(xamlObj as ResourceDictionary);
                }
            }
#if DEBUG
            catch (Exception ex)
            {
                D.Debug("err:" + ex.Message);
                MessageBox.Show(ex.Message);
            }
#endif
            finally { }
        }
    }
}